<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>过滤器</title>
</head>

<body>
    <div class="app">
        <p>{{uname}}</p>
        <p>{{uname | low}}</p>
        <p>{{uname | lar}}</p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        // Vue.filter('lar',function(value) {
        //     return value.charAt(0).toUpperCase() + value.slice(1)

        // })
        Vue.filter('low', function (val) {
            return val.charAt(0).toLowerCase() + val.slice(1)

        })
        var xm = new Vue({
            el: '.app',
            data: {
                uname: 'Hello'
            },
            methods: {
            },
            filters: {
                lar: function(val) {
                    return val.charAt(0).toUpperCase() + val.slice(1)
                }, 
                low: function(val) {
                    return val.charAt(0).toLowerCase() + val.slice(1)
                }
            }

        })

    </script>
</body>

</html>